package de.leuphana.internet.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import de.leuphana.internet.model.Warenkorb;

public class WarenkorbAnzeigenController extends AbstractController {
	@Override
	protected ModelAndView handleRequestInternal(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		HttpSession httpSession = httpServletRequest.getSession(true);

		Warenkorb warenkorb = (Warenkorb) httpSession.getAttribute("warenkorb");
		if (warenkorb == null) {
			warenkorb = new Warenkorb();

			httpSession.setAttribute("warenkorb", warenkorb);
		}

		return new ModelAndView("forward:/Warenkorb");
	}
}